// 导入express
const express = require('express')
const router = require('./router')
const fs = require('fs')
const bodyParser = require('body-parser')
const cors = require('cors')
const app = express()

// cors解决跨域
app.use(cors())
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
app.use('/', router)

// 启动服务器
const server = app.listen(5000, function() {
	const {address, port} = server.address()
	console.log('Http Server is runing at http://%s:%s', address, port)
})